package com.ywjt.platformbusiness.store.adapter;
import android.widget.TextView;

import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.ywjt.platformbusiness.R;
import com.ywjt.platformbusiness.store.model.GoodsClassOneModel;

import java.util.List;

public class GoodsTypeSelectAdapter extends BaseQuickAdapter<GoodsClassOneModel.ResultDTO, BaseViewHolder> {

    public GoodsTypeSelectAdapter(@Nullable List<GoodsClassOneModel.ResultDTO> data) {
        super(R.layout.item_type_meanu, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, GoodsClassOneModel.ResultDTO item) {
        helper.setText(R.id.tvTitle,item.getName());
        TextView tvTitle=helper.getView(R.id.tvTitle);
        if (item.getSelected()==null){
            item.setSelected(false);
        }

        if (item.getSelected()){
            tvTitle.setTextColor(mContext.getResources().getColor(R.color.white));
            tvTitle.setBackgroundResource(R.drawable.red_bg_4);
        }else {
            tvTitle.setTextColor(mContext.getResources().getColor(R.color.gray3));
            tvTitle.setBackgroundResource(R.drawable.gray_bg_2);

        }
    }
}